"""
@author: huangll
@email: ll.huang@hzgosun.com
@time: 2019/6/5 9:32

单兵管理的页面元素
"""

from common.poium import Page
from common.vue.float_window import FloatWindow
from common.vue.table import VueTable, VueTurnPage
from common.vue.label import ElementType as ET
from common.vue.label import ElementBaseLabel
from common.vue.search import VueSearch
from common.vue.button import VueButton


class SearchTools(VueSearch):
    """查询区域"""
    search_access_code = ElementBaseLabel(ET.INPUT, label="单兵查询码")  # 单兵查询码输入框
    search_access_id = ElementBaseLabel(ET.INPUT,label="单兵账号")
    search_individual_person = ElementBaseLabel(ET.INPUT,label="所属人")
    search_sentry_box = ElementBaseLabel(ET.INPUT,label="岗亭")

    search_btn = VueButton("检索")   # 查询按钮

    def __init__(self):
        super(SearchTools, self).__init__()


class Table(VueTable):
    """添加入口"""
    add_btn = VueButton("新增")

    def __init__(self):
        super(Table, self).__init__()


class AddIndividualWindow(FloatWindow):
    """添加单兵弹框"""
    access_code = ElementBaseLabel(ET.INPUT, label='单兵查询码')
    access_id = ElementBaseLabel(ET.INPUT, label='单兵账号')
    individual_person = ElementBaseLabel(ET.DROPDOWN_LIST, label='所属人')
    sentry_box = ElementBaseLabel(ET.DROPDOWN_LIST, label='所属岗亭')

    def __init__(self, title=None, index=None):
        super(AddIndividualWindow, self).__init__(title=title, index=index)


class AlterIndividual(AddIndividualWindow):
    """修改单兵弹框"""
    def __init__(self, title=None, index=None):
        super(AlterIndividual, self).__init__(title=title, index=index)


class DeleteIndividual(AddIndividualWindow):
    """删除单兵"""
    def __init__(self, title=None, index=None):
        super(DeleteIndividual, self).__init__(title=title, index=index)

class IndividualPage(Page):
    searchTools = SearchTools()  # 查询区域
    table = Table()  # 列表，添加入口
    turnPage = VueTurnPage()  # 翻页
    addindividual = AddIndividualWindow(title="新增单兵")  # 添加单兵
    alterindividual = AlterIndividual(title="编辑单兵")  # 修改人口弹窗
    deleteindividual = DeleteIndividual(title="删除确认")  # 删除单兵
